package com.lzh.chatnote.user.controller;


import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.stp.parameter.SaLoginParameter;
import cn.dev33.satoken.util.SaResult;
import com.jayway.jsonpath.internal.function.numeric.Sum;
import com.lzh.chatnote.common.domain.response.ApiResult;
import com.lzh.chatnote.user.domain.vo.request.QueryBatchUserReq;
import com.lzh.chatnote.user.domain.vo.response.user.BadgeResp;
import com.lzh.chatnote.user.domain.vo.response.user.SummaryInfoResp;
import com.lzh.chatnote.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author lzh
 * @since 2025-06-06
 */
@Api(tags = "用户控制器")
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    /**
     * 批量获取用户信息(用于前端进行维护用户信息storage)
     */
    @ApiOperation("批量获取用户信息")
    @GetMapping("/userInfo/batch")
    public ApiResult<List<SummaryInfoResp>> userInfoBatch(@Valid QueryBatchUserReq queryBatchUserReq) {
        return ApiResult.success(userService.userInfoBatch(queryBatchUserReq));
    }

    /**
     * 获取当前用户的可选徽章预览
     * @return ApiResult<List<BadgeResp>>
     */
    @GetMapping("/badges")
    @ApiOperation("可选徽章预览")
    public ApiResult<List<BadgeResp>> badges() {
        return ApiResult.success(userService.badges());
    }


}

